/*
 * @Description  :
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2021-12-14 20:08:17
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-01-18 17:28:07
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\onecar-publish\\address-list\\address-list.component.ts
 * Copyright (C) 2022 huzhenhong. All rights reserved.
 */

import { Component, OnInit, ViewChild } from '@angular/core';
import { STChange, STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
import { processSingleSort } from '@shared';
import { SupplyManagementService } from '../../../services/supply-management.service';
@Component({
  selector: 'app-publish-address-list',
  templateUrl: './address-list.component.html'
})
export class PublishAddressListComponent implements OnInit {
  columns!: STColumn[];
  @ViewChild('st', { static: false })
  st!: STComponent;

  seleteData: any;

  spuStatus = '1'; // '1'客户地址，'2'收回单地址

  constructor(
    public service: SupplyManagementService,
  ) {}

  /**
   * 查询参数
   */
  get reqParams() {
    return {
      type: this.spuStatus
    };
  }
  ngOnInit() {
    this.initST();
  }

  initST() {
    this.columns = [
      { title: '', index: 'id', type: 'radio', width: 70 },
      {
        title: '省市区',
        render: 'region'
      },
      {
        title: '详细地址',
        index: 'detailedAddress'
      },
      {
        title: '联系人',
        index: 'contactName'
      },
      {
        title: '联系电话',
        index: 'contactTelephone'
      },
      {
        title: '更新时间',
        index: 'modifyTime'
      }
    ];
  }

  // 排序
  reqProcess(requestOptions: STRequestOptions): STRequestOptions {
    return processSingleSort(requestOptions);
  }

  change(ret: STChange): void {
    console.log('change', ret);
    this.seleteData = { ...ret.radio };
  }
}
